from decimal import Decimal, localcontext

print(round(1.23, 1))
print(round(1.27, 1))
print(round(-1.27, 1))
print(round(1.25361, 3))

a = 1627731

print(round(a, -1))
print(round(a, -2))
print(round(a, -3))
print(a)

x = 1.23456

print(format(x, '0.2f'))
print(format(x, '0.3f'))
print('Value is {:0.3f}'.format(x))

a = Decimal('4.2')
b = Decimal('2.1')

print(a + b)

a = Decimal('1.3')
b = Decimal('1.7')
print(a / b)

with localcontext() as ctx:
  ctx.prec = 3
  print(a / b)